package com.synergy.stockflow.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
    * 用户表
    */
@Schema(description="用户表")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_user")
public class SysUser {
    /**
     * 用户编号
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description="用户编号")
    private Long id;

    /**
     * 多租户标识
     */
    @TableField(value = "tenant_id")
    @Schema(description="多租户标识")
    private String tenantId;

    /**
     * 账户名
     */
    @TableField(value = "username")
    @Schema(description="账户名")
    private String username;

    /**
     * 密码
     */
    @TableField(value = "`password`")
    @Schema(description="密码")
    private String password;

    /**
     * 盐值
     */
    @TableField(value = "salt")
    @Schema(description="盐值")
    private String salt;

    /**
     * 用户状态 (0:禁用, 1:启用)
     */
    @TableField(value = "`status`")
    @Schema(description="用户状态 (0:禁用, 1:启用)")
    private Byte status;

    /**
     * 昵称或真实姓名
     */
    @TableField(value = "nickname")
    @Schema(description="昵称或真实姓名")
    private String nickname;

    /**
     * 头像链接
     */
    @TableField(value = "avatar")
    @Schema(description="头像链接")
    private String avatar;

    /**
     * 邮箱地址
     */
    @TableField(value = "email")
    @Schema(description="邮箱地址")
    private String email;

    /**
     * 手机号
     */
    @TableField(value = "phone")
    @Schema(description="手机号")
    private String phone;

    /**
     * 性别 (0:男, 1:女, 2:保密)
     */
    @TableField(value = "gender")
    @Schema(description="性别 (0:男, 1:女, 2:保密)")
    private Byte gender;

    /**
     * 部门编号
     */
    @TableField(value = "dept_id")
    @Schema(description="部门编号")
    private Integer deptId;

    /**
     * 创建人
     */
    @TableField(value = "create_by")
    @Schema(description="创建人")
    private Long createBy;

    /**
     * 注册时间
     */
    @TableField(value = "create_time")
    @Schema(description="注册时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 逻辑删除 (0:默认, 1:删除)
     */
    @TableField(value = "del_flag")
    @Schema(description="逻辑删除 (0:默认, 1:删除)")
    private Byte delFlag;

    @TableField(exist = false)
    @Schema(description = "用户角色")
    private List<SysUserRole> userRoles;
}